<?php 
/**
 * @version        $Id$
 * @author         master@xuewl.com
 * @copyright      Copyright (c) 2007 - 2013, Chongqing Zero Technology Co. Ltd.
 * @link           http://www.xuewl.com
**/
namespace Document\Model;
use Think\Model;
Class DamaLogModel extends Model {

	/*自动验证*/
	protected $_validate = array ();

	protected $_auto = array (
		//array(填充字段,填充内容,填充条件,附加规则)
        array('inputtime', NOW_TIME, self::MODEL_INSERT, string),     
        array('updatetime', NOW_TIME, self::MODEL_BOTH, string),     
	);
	/**
	 * 添加平台数据
	 * @param  $data 页面参数数组
	 */
	public function update($data, $iscreate = TRUE) {
        if ($iscreate == TRUE) $data = $this->create($data);
        if (empty($data)) {
            $this->error = $this->getError();
            return false;
        }
        if (isset($data['id']) && is_numeric($data['id'])) {
            $result = $this->save($data);
            if (!$result) {
                $this->error = '更新数据失败';
                return false;
            }
        } else {
            $result = $this->add($data);
            if ($result === false) {
                $this->error = '添加数据失败';
                return false;
            }
        }
        return $result;
    }


}